package com.xykj.service.impl;

import com.xykj.common.entry.NewsFlash;
import com.xykj.mapper.NewsFlashMapper;
import com.xykj.pojo.dto.NewsFlashDto;
import com.xykj.service.NewsFlashService;
import com.xykj.web.websocket.NewsWebSocketHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassDescription: 证券快讯表Service层实现类
 * @author:yzh
 * @create:2025/5/12 22:17
 **/
@Service
public class NewsFlashServiceImpl implements NewsFlashService {
    @Autowired
    private NewsFlashMapper newsFlashMapper;

    @Autowired
    private NewsWebSocketHandler newsWebSocketHandler;

    @Override
    public List<NewsFlashDto> queryNewsFlash(Integer pageNum, Integer pageSize) {
        int offset = (pageNum-1)*pageSize;
        return newsFlashMapper.selectLatest(offset,pageSize);
    }

    @Override
    public Integer totalNewsFlash() {
        return newsFlashMapper.countAll();
    }


}
